﻿using Joker.Model;
using Joker.View;
using Joker.View.Management;
using Joker.View.SubForm;
using Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Joker {
    public partial class MainForm : Form {
        private Form LastForm = new Form();
        public Random random = new Random();
        public MainForm() {
            InitializeComponent();
        }
        private void MainForm_Load(object sender, EventArgs e) {
            OpenForm.ChildForm(this, new WelcomeForm(), FormPanel);
        }
        private void OpenSubForm(Form subform) {
            subform.BackColor = menuStrip1.BackColor;
            OpenForm.ChildForm(this, subform, FormPanel);
            LastForm.Close();
            LastForm = subform;
        }

        private void UserInfo_Click(object sender, EventArgs e) {
            OpenSubForm(new UserManage());
        }

        private void SupplyInfo_Click(object sender, EventArgs e) {
            OpenSubForm(new SupplyManage());
        }
        private void GoodsInfo_Click(object sender, EventArgs e) {
            OpenSubForm(new GoodsManage());
        }

        private void WarehouseInfo_Click(object sender, EventArgs e) {
            OpenSubForm(new WarehouseManage());
        }

        private void PurchaseManage_Click(object sender, EventArgs e) {
            OpenSubForm(new PurchaseManage());
        }
        private void WarehouseInManage_Click(object sender, EventArgs e) {
            OpenSubForm(new WarehouseInManage());
        }

        private void WarehouseOutManage_Click(object sender, EventArgs e) {
            OpenSubForm(new WarehouseOutManage());
        }

        private void ReviewManage_Click(object sender, EventArgs e) {
            OpenSubForm(new ReviewForm());
        }

        private void 换肤ToolStripMenuItem_Click(object sender, EventArgs e) {
            menuStrip1.BackColor = Color.FromArgb(random.Next(256), random.Next(256), random.Next(256));
            LastForm.BackColor = menuStrip1.BackColor;
        }
    }
}
